/**	
 * Author : Mht
 * Desc : For 2016 RDM 
 */
package service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import dao.user.UserDao;
import entity.user.User;
import lombok.extern.log4j.Log4j;

/**
 * @author Mht
 * @date May 10, 2016
 */
@Log4j
@Service
public class RedisPushService {

	@Autowired
	private UserDao userDao;

	public void addUser() {
		User user = null;
		List<User> userList = new ArrayList<User>();
		for (int i = 0; i < 10000; i++) {
			user = new User(i, "Mht", "521");
			userList.add(user);
		}
		userDao.insert("Cy", userList);
		log.info("Redis Add ::::: " + userDao.get("Cy").toString());
	}
	
	public void insert() {
		User user = new User(1000000, "Mht", "521");;
		List<User> userList = new ArrayList<User>();
		for (int i = 0; i < 10000; i++) {
			user = new User(i, "Mht", "521");
			userList.add(user);
		}
		userDao.insert("Cy", user);
		log.info("Redis Insert ::::: " + userDao.get("Cy").toString());
		userDao.insert("Cy", "Mht");
		log.info("Redis Insert ::::: " + userDao.get("Cy").toString());
	}
}
